from django.db import models

class Homework(models.Model):
    title = models.CharField(max_length=200)
    description = models.TextField()
    due_date = models.DateField()
    completed = models.BooleanField(default=False)

    def __str__(self):
        return self.title
    

class Question(models.Model):
    question_subject = models.TextField(max_length=20, null=True, verbose_name='错题科目', default=None, blank=True)
    question_type = models.TextField(null=True, verbose_name='错题类型', default=None, blank=True)
    question_content = models.TextField(max_length=200, null=True, verbose_name='错题内容', default=None, blank=True)
    wrong_answer = models.TextField(max_length=200, null=True, verbose_name='错误答案', default=None, blank=True)
    correct_answer = models.TextField(max_length=200, null=True, verbose_name='正确答案', default=None, blank=True)
    error_type = models.IntegerField(null=True, verbose_name='错误类型', default=1, blank=True)
    question_source = models.TextField(max_length=20, null=True, verbose_name='错题来源', default=None, blank=True)
    difficulty_level = models.SmallIntegerField(null=True, verbose_name='错题难度', default=1, blank=True)
    create_date = models.DateField(auto_now_add=True)

    def __str__(self):
        return self.question_id + " " + self.question_content